import i18n from "@/i18n/configs";
import { Middleware } from "redux";
export const changeLanguageMiddleWare: Middleware =
  (store) => (next) => (action) => {
    const oldLanguage = store.getState().language.language;
    next(action);
    const newLanguage = store.getState().language.language;
    if (oldLanguage !== newLanguage) {
      i18n.changeLanguage(newLanguage);
    }
  };
